package com.xdtech.sys.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.sys.model.Params;
import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-05-31 22:43:28
 * @since 1.0
 * @see
 */
public class ParamsItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="参数编码",width=100)
	private String code;
	@GridColumn(title="参数值",width=100)
	private String codeValue;
	@GridColumn(title="是否初始",width=100,dictionaryCode="YES_OR_NO")
	private String initToApp;
	@GridColumn(title="参数说明",width=200)
	private String codeDesc;
	
	public void setId(Long id) {
		this.id = id;
		addQuerys("id", id);
	}
	public Long getId() {
		return id;
	}
	
	public void setCode(String code) {
		this.code = code;
		addQuerys("code", code);
	}
	public String getCode() {
		return code;
	}
	
	public void setCodeValue(String codeValue) {
		this.codeValue = codeValue;
		addQuerys("codeValue", codeValue);
	}
	public String getCodeValue() {
		return codeValue;
	}
	
	public void setCodeDesc(String codeDesc) {
		this.codeDesc = codeDesc;
		addQuerys("codeDesc", codeDesc);
	}
	public String getCodeDesc() {
		return codeDesc;
	}
	
	public String getInitToApp()
	{
		return initToApp;
	}
	public void setInitToApp(String initToApp)
	{
		this.initToApp = initToApp;
		addQuerys("initToApp", initToApp);
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static ParamsItem createItem(Params params) {
		ParamsItem paramsItem = new ParamsItem();
		BeanUtils.copyProperties(paramsItem, params);
		//自定义属性设置填充
		return paramsItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<ParamsItem> createItems(List<Params> paramss) {
		List<ParamsItem> paramsItems = new ArrayList<ParamsItem>();
		for (Params params : paramss) {
			paramsItems.add(createItem(params));
		}
		return paramsItems;
	}
}
